﻿Public Class m__asignaciones
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        seguridad.verificapermisos()
    End Sub

    Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
        'ASPxGridViewExporter1.WritePdfToResponse()
    End Sub

    Protected Sub ImageButton2_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton2.Click
        'ASPxGridViewExporter1.WriteXlsxToResponse()
    End Sub

    Protected Sub ASPxButton1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ASPxButton1.Click

        Dim fecha As Date
        fecha = Date.Now
        'MsgBox(fecha)




        Dim query As String = String.Format("INSERT INTO asignaciones (usuarioid,fecha,descripcion,solicitudid) values('{0}','{1}','{2}','{3}')", ASPxComboBox1.Value, fecha, TextBox1.Text, ASPxComboBox2.Value)

        Dim conn As New Devart.Data.PostgreSql.PgSqlConnection(seguridad.conexion)
        conn.Open()
        Dim ejec As New Devart.Data.PostgreSql.PgSqlCommand(query, conn)
        ejec.ExecuteNonQuery()
        ASPxGridView1.DataBind()
        ASPxComboBox1.Text = ""
        ASPxComboBox2.Text = ""
        txtestado.Text = ""
        txtfecha.Text = ""
        txtmail.Text = ""
        txtnombre.Text = ""
        txtservicio.Text = ""
        txtservicio.Text = ""
        txttelefono.Text = ""
        'conn.Close()



    End Sub

    Protected Sub ASPxComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles ASPxComboBox1.SelectedIndexChanged
        txtnombre.Text = ASPxComboBox1.SelectedItem.GetValue("usuarionombrecompleto")
        txtmail.Text = ASPxComboBox1.SelectedItem.GetValue("usuarioemail")
        txttelefono.Text = ASPxComboBox1.SelectedItem.GetValue("usuariotelefono")
    End Sub

    Protected Sub ASPxComboBox1_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles ASPxComboBox1.TextChanged
      
    End Sub

    Protected Sub ASPxComboBox2_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles ASPxComboBox2.SelectedIndexChanged
        txtfecha.Text = ASPxComboBox1.SelectedItem.GetValue("fecha")
        txtestado.Text = ASPxComboBox1.SelectedItem.GetValue("estado")
        txtservicio.Text = ASPxComboBox1.SelectedItem.GetValue("servicioid")
    End Sub
End Class